<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>新增学员信息</title>
    <style>
        * {
            margin: auto 0px;
        }
    </style>
</head>
<body>
<div align="center">
    <form id="stuform" action="${pageContext.request.contextPath }/student/add" method="post">
        <table border="1" align="center" style="text-align: center">
            <tr style="background-color: #ccc">
                <td colspan="2" style="height: 60px">学员信息</td>
            </tr>
            <tr>
                <td>学员姓名</td>
                <td><input id="sname" name="sname" value=""></td>
            </tr>
            <tr>
                <td>学员性别</td>
                <td><input id="sgender" name="sgender" value=""></td>
            </tr>
            <tr>
                <td>学员年龄</td>
                <td><input id="sage" name="sage" value=""></td>
            </tr>
            <tr>
                <td>家庭住址</td>
                <td><input id="saddress" name="saddress" value=""></td>
            </tr>
            <tr>
                <td>Email</td>
                <td><input id="semail" name="semail" value=""></td>
            </tr>
            <tr>
                <td colspan="2"><input type="submit" id="save" value="添加" onsubmit="return check();"></td>
            </tr>
        </table>
    </form>
</div>
<script src="${pageContext.request.contextPath }/statics/js/jquery-1.12.4.js"></script>
<script>
    function check() {
        var sname = $("#sname");
        if (sname.val() == '') {
            alert("学员姓名不能为空");
            sname.focus();
            return false;
        }
        var sgender = $("#sgender");
        if (sgender.val() == '') {
            alert("学员性别不能为空");
            sgender.focus();
            return false;
        }
        var sage = $("#sage");
        if (sage.val() == '') {
            alert("学员年龄不能为空");
            sage.focus();
            return false;
        }
        return true;
    }
</script>
</body>
</html>